<?

	$username       = mysql_escape_string(trim($_POST[user_name]));
	$password       = md5(trim($_POST[password]));
	$firstname      = mysql_escape_string(trim($_POST[firstname]));
	$lastname       = mysql_escape_string(trim($_POST[lastname]));
	$email          = mysql_escape_string(trim($_POST[email]));
	$phone          = mysql_escape_string(trim($_POST[phone]));
	$fax            = mysql_escape_string(trim($_POST[fax]));
	$jobtitle       = mysql_escape_string(trim($_POST[jobtitle]));
	$skype          = mysql_escape_string(trim($_POST[skype]));
	$spokenlanguage = mysql_escape_string(trim($_POST[spokenlanguage]));
	$newsmailist    = mysql_escape_string(trim($_POST[newsmailist]));
	$recruitex      = mysql_escape_string(trim($_POST[recruitex]));
	$description    = ucfirst(mysql_escape_string(trim($_POST[description])));
	$howus          = mysql_escape_string(trim($_POST[howus]));
	$servicecode    = mysql_escape_string(trim($_POST[servicecode]));
    $companyname    = mysql_escape_string(trim($_POST[companyname]));
	$companyurl     = mysql_escape_string(trim($_POST[companyurl]));
	$industry       = mysql_escape_string(trim($_POST[industry]));
	$companysize    = mysql_escape_string(trim($_POST[companysize]));
	$address        = mysql_escape_string(trim($_POST[address]));
	$locity         = mysql_escape_string(trim($_POST[locity]));
	$lostate        = mysql_escape_string(trim($_POST[lostate]));
    $zip            = mysql_escape_string(trim($_POST[zip]));
	$locountry      = mysql_escape_string(trim($_POST[locountry]));
	$generalarea    = mysql_escape_string(trim($_POST[generalarea]));
	$pristate       = mysql_escape_string(trim($_POST[pristate]));
	$pricountry     = mysql_escape_string(trim($_POST[pricountry]));
	$indicate       = mysql_escape_string(trim($_POST[indicate]));
	$recruit        = mysql_escape_string(trim($_POST[recruit]));
	$share          = mysql_escape_string(trim($_POST[share]));
	$business       = mysql_escape_string(trim($_POST[business]));
	$contract       = mysql_escape_string(trim($_POST[contract]));
	$consulting       = mysql_escape_string(trim($_POST[consulting]));
	$topspecialty   = mysql_escape_string(trim($_POST[topspecialty]));
	$morespecialty  = mysql_escape_string(trim($_POST[morespecialty]));
	$hrexperience	= mysql_escape_string(trim($_POST[hrexperience]));
	$moreindustry	= mysql_escape_string(trim($_POST[moreindustry]));

	$myclient1      = mysql_escape_string(trim($_POST[myclient1]));
	$myclient2      = mysql_escape_string(trim($_POST[myclient2]));
	$myclient3      = mysql_escape_string(trim($_POST[myclient3]));
	$myonline1      = mysql_escape_string(trim($_POST[myonline1]));
	$myonline2      = mysql_escape_string(trim($_POST[myonline2]));
	$myonline3      = mysql_escape_string(trim($_POST[myonline3]));
	$myfavoritet1   = mysql_escape_string(trim($_POST[myfavoritet1]));
	$myfavoritet2   = mysql_escape_string(trim($_POST[myfavoritet2]));
	$myfavoritet3   = mysql_escape_string(trim($_POST[myfavoritet3]));	
	$myprofession1  = mysql_escape_string(trim($_POST[myprofession1]));
	$myprofession2  = mysql_escape_string(trim($_POST[myprofession2]));
	$myprofession3  = mysql_escape_string(trim($_POST[myprofession3]));
	$pristatus		= mysql_escape_string(trim($_POST[pristatus]));
	$ifshow_email	= mysql_escape_string(trim($_POST[ifshow_email]));
	$ifshow_phone	= mysql_escape_string(trim($_POST[ifshow_phone]));
	$ifshow_fax		= mysql_escape_string(trim($_POST[ifshow_fax]));
	$ifshow_jobtitle = mysql_escape_string(trim($_POST[ifshow_jobtitle]));
	$ifshow_skype	= mysql_escape_string(trim($_POST[ifshow_skype]));
	$ifshow_spokenlanguage = mysql_escape_string(trim($_POST[ifshow_spokenlanguage]));
	$ifshow_recruitex = mysql_escape_string(trim($_POST[ifshow_recruitex]));
	$ifshow_companyurl = mysql_escape_string(trim($_POST[ifshow_companyurl]));
	$ifshow_address	= mysql_escape_string(trim($_POST[ifshow_address]));


	if(!empty($_SESSION[reginfo])){
	  	    $username       = mysql_escape_string(trim($_SESSION[reginfo][user_name]));
			$password       = md5(trim($_SESSION[reginfo][password]));
			$firstname      = mysql_escape_string(trim($_SESSION[reginfo][firstname]));
			$lastname       = mysql_escape_string(trim($_SESSION[reginfo][lastname]));
			$email          = mysql_escape_string(trim($_SESSION[reginfo][email]));
			$phone          = mysql_escape_string(trim($_SESSION[reginfo][phone]));
			$fax            = mysql_escape_string(trim($_SESSION[reginfo][fax]));
			$jobtitle       = mysql_escape_string(trim($_SESSION[reginfo][jobtitle]));
			$skype          = mysql_escape_string(trim($_SESSION[reginfo][skype]));
			$spokenlanguage = mysql_escape_string(trim($_SESSION[reginfo][spokenlanguage]));
			$recruitex      = mysql_escape_string(trim($_SESSION[reginfo][recruitex]));
			$description    = ucfirst(mysql_escape_string(trim($_SESSION[reginfo][description])));
			$howus          = mysql_escape_string(trim($_SESSION[reginfo][howus]));
			$servicecode    = mysql_escape_string(trim($_SESSION[reginfo][servicecode]));
			$companyname    = mysql_escape_string(trim($_SESSION[reginfo][companyname]));
			$companyurl     = mysql_escape_string(trim($_SESSION[reginfo][companyurl]));
			$industry       = mysql_escape_string(trim($_SESSION[reginfo][industry]));
			$companysize    = mysql_escape_string(trim($_SESSION[reginfo][companysize]));
			$address        = mysql_escape_string(trim($_SESSION[reginfo][address]));
			$locity         = mysql_escape_string(trim($_SESSION[reginfo][locity]));
			$lostate        = mysql_escape_string(trim($_SESSION[reginfo][lostate]));
			$zip            = mysql_escape_string(trim($_SESSION[reginfo][zip]));
			$locountry      = mysql_escape_string(trim($_SESSION[reginfo][locountry]));
			$generalarea    = mysql_escape_string(trim($_SESSION[reginfo][generalarea]));
			$pristate       = mysql_escape_string(trim($_SESSION[reginfo][pristate]));
			$pricountry     = mysql_escape_string(trim($_SESSION[reginfo][pricountry]));
			$indicate       = mysql_escape_string(trim($_SESSION[reginfo][indicate]));
			$recruit        = mysql_escape_string(trim($_SESSION[reginfo][recruit]));
			$share          = mysql_escape_string(trim($_SESSION[reginfo][share]));
			$business       = mysql_escape_string(trim($_SESSION[reginfo][business]));
			$contract       = mysql_escape_string(trim($_SESSION[reginfo][contract]));
			$consulting     = mysql_escape_string(trim($_SESSION[reginfo][consulting]));
			$topspecialty   = mysql_escape_string(trim($_SESSION[reginfo][topspecialty]));
			$morespecialty  = mysql_escape_string(trim($_SESSION[reginfo][morespecialty]));
			$hrexperience	= mysql_escape_string(trim($_SESSION[reginfo][hrexperience]));
			$moreindustry	= mysql_escape_string(trim($_SESSION[reginfo][moreindustry]));

			$myclient1      = mysql_escape_string(trim($_SESSION[reginfo][myclient1]));
			$myclient2      = mysql_escape_string(trim($_SESSION[reginfo][myclient2]));
			$myclient3      = mysql_escape_string(trim($_SESSION[reginfo][myclient3]));
			$myonline1      = mysql_escape_string(trim($_SESSION[reginfo][myonline1]));
			$myonline2      = mysql_escape_string(trim($_SESSION[reginfo][myonline2]));
			$myonline3      = mysql_escape_string(trim($_SESSION[reginfo][myonline3]));
			$myfavoritet1   = mysql_escape_string(trim($_SESSION[reginfo][myfavoritet1]));
			$myfavoritet2   = mysql_escape_string(trim($_SESSION[reginfo][myfavoritet2]));
			$myfavoritet3   = mysql_escape_string(trim($_SESSION[reginfo][myfavoritet3]));	
			$myprofession1  = mysql_escape_string(trim($_SESSION[reginfo][myprofession1]));
			$myprofession2  = mysql_escape_string(trim($_SESSION[reginfo][myprofession2]));
			$myprofession3  = mysql_escape_string(trim($_SESSION[reginfo][myprofession3]));	
			$pristatus		= mysql_escape_string(trim($_SESSION[reginfo][pristatus]));
			$ifshow_email	= mysql_escape_string(trim($_SESSION[reginfo][ifshow_email]));
			$ifshow_phone	= mysql_escape_string(trim($_SESSION[reginfo][ifshow_phone]));
			$ifshow_fax		= mysql_escape_string(trim($_SESSION[reginfo][ifshow_fax]));
			$ifshow_jobtitle = mysql_escape_string(trim($_SESSION[reginfo][ifshow_jobtitle]));
			$ifshow_skype	= mysql_escape_string(trim($_SESSION[reginfo][ifshow_skype]));
			$ifshow_spokenlanguage = mysql_escape_string(trim($_SESSION[reginfo][ifshow_spokenlanguage]));
			$ifshow_recruitex = mysql_escape_string(trim($_SESSION[reginfo][ifshow_recruitex]));
			$ifshow_companyurl = mysql_escape_string(trim($_SESSION[reginfo][ifshow_companyurl]));
			$ifshow_address	= mysql_escape_string(trim($_SESSION[reginfo][ifshow_address]));
	
	}

	$licensenumber       = mysql_escape_string(trim($_POST[licensenumber]));
	$licenseissue        = mysql_escape_string(trim($_POST[licenseissue]));
	$licensephone        = mysql_escape_string(trim($_POST[licensephone]));
    $companyname1        = mysql_escape_string(trim($_POST[companyname1]));
    $contactname1        = mysql_escape_string(trim($_POST[contactname1]));
    $phonenumber1        = mysql_escape_string(trim($_POST[phonenumber1]));
	$email1              = mysql_escape_string(trim($_POST[email1]));
    $relationship1       = mysql_escape_string(trim($_POST[relationship1]));
	$companyname2        = mysql_escape_string(trim($_POST[companyname2]));
    $contactname2        = mysql_escape_string(trim($_POST[contactname2]));
    $phonenumber2        = mysql_escape_string(trim($_POST[phonenumber2]));
	$email2              = mysql_escape_string(trim($_POST[email2]));
    $relationship2       = mysql_escape_string(trim($_POST[relationship2]));
	$companyname3        = mysql_escape_string(trim($_POST[companyname3]));
    $contactname3        = mysql_escape_string(trim($_POST[contactname3]));
    $phonenumber3        = mysql_escape_string(trim($_POST[phonenumber3]));
	$email3              = mysql_escape_string(trim($_POST[email3]));
    $relationship3       = mysql_escape_string(trim($_POST[relationship3]));
//验证注册
	$sql_1  = " select ep_uname,ep_pword from pa_employer where ep_uname = '".$username."' ";
	$arr1 = $DB->fetch_one_array($sql_1);
	$sql_2  = " select js_uname,js_pword from pa_candidates where js_uname ='".$username."'";
	$arr2 = $DB->fetch_one_array($sql_2);
	$sql_3  = " select rc_uname,rc_pword from pa_recuiter where rc_uname ='".$username."'";
	$arr3 = $DB->fetch_one_array($sql_3);
	$sql_4  = " select ad_uname,ad_pword from pa_advisory where ad_uname ='".$username."'";
	$arr4 = $DB->fetch_one_array($sql_4);
//验证注册：邮箱
	$sql_mail_1  = " select ep_uname,ep_pword from pa_employer where ep_email = '".$email."' ";
	$arr_mail_1 = $DB->fetch_one_array($sql_mail_1);
	$sql_mail_2  = " select js_uname,js_pword from pa_candidates where js_email ='".$email."'";
	$arr_mail_2 = $DB->fetch_one_array($sql_mail_2);
	$sql_mail_3  = " select rc_uname,rc_pword from pa_recuiter where rc_email ='".$email."'";
	$arr_mail_3 = $DB->fetch_one_array($sql_mail_3);
	$sql_mail_4  = " select ad_uname,ad_pword from pa_advisory where ad_email ='".$email."'";
	$arr_mail_4 = $DB->fetch_one_array($sql_mail_4);

	if($_FILES["uploadfile"][name]!=''){
	   $f = new upfile("./uploadfiles/recruiter/","gif,jpg,png");
	  if($f->upload("uploadfile")){
		 $filename1 = $f->savename;
		 $filename1p = $filename1;
		 //切割
		 if(file_exists("./uploadfiles/recruiter/".$filename1)){
			$big_image_name = "./uploadfiles/recruiter/".$filename1;
			$filename1 = substr($filename1, 0, -4);
			$cutbig = "./uploadfiles/recruiter/".$filename1;
			@miniature($big_image_name, $cutbig, $max_width = 100, $max_height = 100, $resize = 1);
		 } 
	   }
	}

    $deadline = $deadline_conf + time();
	if(empty($arr1)&&empty($arr2)&&empty($arr3)&&empty($arr4)&&empty($arr_mail_1)&&empty($arr_mail_2)&&empty($arr_mail_3)&&empty($arr_mail_4)){
			$date = date("Y-m-d",time());
			$sql = "INSERT INTO `pa_recuiter` ( `rc_servicecode`, `rc_uname`, `rc_pword`, `rc_copname`, `rc_fname`, `rc_lname`, `rc_title`, `rc_address1`, `rc_industry`, `rc_copsize`, `rc_country`, `rc_howus`, `rc_newsmailist`, `rc_generalarea`, `rc_pristate`, `rc_pricountry`, `rc_indicate`, `rc_recruit`, `rc_spokenlanguage`, `rc_recruitex`,`rc_uploadfile`, `rc_skype`, `rc_state`, `rc_city`, `rc_zip`, `rc_phone`, `rc_fax`, `rc_mobphone`, `rc_email`, `rc_website`, `rc_regtime`, `rc_deadline`, `rc_description`, `rc_share`,`rc_business` ,`rc_contract`,`rc_consulting`,`rc_status`,`rc_topspecialty`,`rc_morespecialty`,`rc_hrexperience`,`rc_moreindustry`, `rc_top3_1`,`rc_pristatus`, `rc_license`, `rc_license_Issue`, `rc_license_office`, `rc_pr1_cpname`, `rc_pr1_ctname`, `rc_pr1_phone`, `rc_pr1_email`, `rc_pr1_relationship`, `rc_pr2_cpname`, `rc_pr2_ctname`, `rc_pr2_phone`, `rc_pr2_email`, `rc_pr2_relationship`, `rc_pr3_cpname`, `rc_pr3_ctname`, `rc_pr3_phone`, `rc_pr3_email`, `rc_pr3_relationship`,`rc_logintime`,`ifshow_email`,`ifshow_phone`,`ifshow_fax`,`ifshow_jobtitle`,`ifshow_skype`,`ifshow_spokenlanguage`,`ifshow_recruitex`,`ifshow_companyurl`,`ifshow_address`) VALUES ( '".$servicecode."', '".$username."', '".$password."', '".$companyname."', '".$firstname."', '".$lastname."', '".$jobtitle."', '".$address."', '".$industry."', '".$companysize."', '".$locountry."', '".$howus."', '".$newsmailist."', '".$generalarea."', '".$pristate."', '".$pricountry."', '".$indicate."', '".$recruit."', '".$spokenlanguage."', '".$recruitex."', '".$filename1p."', '".$skype."', '".$lostate ."', '".$locity."', '".$zip."', '".$phone."', '".$fax."', '".$mobilephone."', '".$email."', '".$companyurl."', '".time()."', '".$deadline."', '".$description."','".$share."','".$business."','".$contract."','".$consulting."','0', '".$topspecialty."','".$morespecialty."','".$hrexperience."','".$moreindustry."','".$myclient1."', '".$pristatus."', '".$licensenumber."', '".$licenseissue."', '".$licensephone."', '".$companyname1."', '".$contactname1."', '".$phonenumber1."','".$email1."', '".$relationship1."', '".$companyname2."', '".$contactname2."', '".$phonenumber2."','".$email2."' ,'".$relationship2."', '".$companyname3."', '".$contactname3."', '".$phonenumber3."','".$email2."', '".$relationship3."','".time()."','".$ifshow_email."','".$ifshow_phone."','".$ifshow_fax."','".$ifshow_jobtitle."','".$ifshow_skype."','".$ifshow_spokenlanguage."','".$ifshow_recruitex."','".$ifshow_companyurl."','".$ifshow_address."');";
			$DB->query($sql);
			$sql_3  = " select rc_regtime,rc_uname,rc_pword,rc_id,rc_deadline,rc_status from pa_recuiter where BINARY rc_uname ='".$username."'";
			$arr3 = $DB->fetch_one_array($sql_3);

			//$_SESSION[uname] = $username;
			//if(!empty($arr3)){$_SESSION[usertype] = "recruiter"; $_SESSION[regtime] = $arr3[rc_regtime]; $_SESSION[perfix] = "rc_";$_SESSION[uid] = $arr3[rc_id];$_SESSION[homeUrl] = "rec_home.php"; $_SESSION[deadline] = $arr3[rc_deadline]; $_SESSION['status'] = $ALLSTATUS[$arr3[rc_status]];}


           
            if($_POST[sam]=="Buy Now"||$_POST[buy]==1){
			   $err  = "<h3 style=\"color:red\">You have successfully registered!  Please wait while we connect you to your account.</h3><meta http-equiv=\"refresh\" content=\"3;URL=cybersource.php?utype=recruiter&uname=$username\">";
			    $content    = "Welcome to our community!  You have successfully purchased a  membership account with enetRecruiter!  Before you may participate in job assignments on our site you must complete our pre-qualification and receive approval for Premium membership.  A representative will contact you shortly to guide you through the process.  Meanwhile, you may access our site at the \"Standard Membership\" level which allows you access to all the resources and tools on our site except submitting candidates, post jobs and create chats.  Only Premium Membership holders may submit candidates, post jobs, and create chats.  
				<br><br>
				The Premium membership approval process normally takes two weeks, provided we have all the information we need from you.  This is an important step we must take to maintain a high level of service on our site.  Whether your account is ultimately approved or not, you will receive an email from us.  We appreciate your patience and cooperation as we try our best to expedite our approval.  
				<br><br>
				As a reminder, your Standard or Premium membership is automatically renewed every month and the membership fee will be charged to the credit card you provided at the time of registration.  Currently, the monthly fee for Standard and Premium membership is the same.  You may elect to cancel your membership at any time by going to your My Accounts page.  Fees paid for partial months are not refundable.  
				<br><br>
				If you have any questions or comments regarding your account or our website please send emails to <a href='mailto:account@enetrecruiter.com'>account@enetrecruiter.com</a>.  For immediate answers, you are welcome to visit the HELP pages.    
				<br><br>
				--enetRecruiter Membership Support Team<br><br>
				<a href='http://www.enetrecruiter.com'>www.enetrecruiter.com</a>";
				$to2		=  "sales@enetrecruiter.com,svoline@yahoo.com";
				$subject    = "Your Standard Recruiter Membership Is Now Active";

			}else{
			   $verify  = "<h3 style=\"color:black;font-weight:normal\">Congratulations! You have successfully completed the first step of our registration. To activate your account, you will need to verify the email address you provided. Please check the email we just sent to your email address. Be sure to look in your inbox and junk mail. You will have 24 hours to activate your account.<br><br>Please feel free to contact us <a href=\"contactus.php\">here</a> if you have any questions.</h3>";
			   
				
				$safeEmail= authcode ( $email, 'ENCODE', 'safeEmail', 3600 );  
				$urlEnSafeEmail = urlencode ( $safeEmail );  
				$content = "Thanks for your interest in joining enetRecruiter. You're almost there...just one more step! To activate your account, click on the link below. If the link below does not work or if your didn't sign up for this account please contact us <a href='http://www.enetrecruiter.com/contactus.php'>here</a> or reply to this message. <br><br>";
				$content .= "Be sure to add us to your safe sender's list so you can quickly receive our emails going forward! <br><br>";

				$content .= "<a href='http://www.enetcentral.com/verify.php?type=rec&account=$username&code=$urlEnSafeEmail'>http://www.enetcentral.com/verify.php?type=rec&account=$username&code=$urlEnSafeEmail</a><br><br>";

				$content .= "The Support Team<br>enetRecruiter, LLC";

		        $to2       =  "trial@enetrecruiter.com,svoline@yahoo.com";
				$subject   =  "enetRecruiter Account Activation";
			
			}
			$headers .= "From: enetRecruiter Support <account@enetrecruiter.com>" . "\r\n";
			$headers .= "Content-type: text/html; charset=utf-8" . "\r\n";
			
			$to       = $email;
			@mail($to, $subject, $content, $headers);


			$subject  = "New Recruiter Starter User";
			$content  = "This email is sent to inform you that a new registration has occurred. <br>
			              1) User Type :  $_SESSION[usertype] <br>  
						  2) Username  :  $username<br>
						  3) First Name : $firstname<br>
						  4) Last Name : $lastname <br> 
						  5) Email Address : $email<br> 
						  6) Phone Number : $phone<br>
						  7) Company Name : $companyname <br> 
						  8) Job Title : $jobtitle <br> 
						  9) Industry  : $jobcategory[$industry] <br>";
			$headers .= "From: enetRecruiter Support <account@enetrecruiter.com>" . "\r\n";
			$headers .= "Content-type: text/html; charset=utf-8" . "\r\n";
            //$to       =  "trial@enetrecruiter.com";
			@mail($to2, $subject, $content, $headers);

	}else{
		if(!(empty($arr1)&&empty($arr2)&&empty($arr3)&&empty($arr4))){
			 $err .= "<h3 style=\"color:red\">The username is already taken. Please try another one.</h3>";
		}
		if(!(empty($arr_mail_1)&&empty($arr_mail_2)&&empty($arr_mail_3)&&empty($arr_mail_4))){
			 $err .= "<h3 style=\"color:red\">The email address is already taken. Please use another one.</h3>";
		}
	}
    unset($_SESSION[reginfo]);






 


















?>